package com.woniuxy.carrental.mapper;

import com.woniuxy.carrental.entity.Carpart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author xilei
 * @create 2021-09-28 上午 11:40
 */
@Mapper
public interface CarpartMapper {
    //查所有汽配信息
    List<Carpart> findCarpart();
    //分页查汽配信息
    List<Carpart> findCarpartBypage(@Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
    //分页查+按条件查汽配信息
    List<Carpart> findCarpartBypageByparm(@Param("carpart_name") String carpart_name,
                                          @Param("carpart_type") String carpart_type,
                                          @Param("carpart_vehicle") String carpart_vehicle,
                                          @Param("pageIndex") Integer pageIndex,
                                          @Param("pageSize") Integer pageSize);
    //改汽配信息
    void updateCarpart(@Param("carpart_name") String carpart_name,
                   @Param("carpart_type") String carpart_type,
                   @Param("carpart_vehicle") String carpart_vehicle,
                   @Param("carpart_picture") String carpart_picture,
                   @Param("carpart_id") Integer carpart_id);
    //删汽配信息
    void deleteCarpart(Integer carpart_id);
    //增汽配信息
    void insertCarpart(Carpart carpart);

    //根据名称查询汽配表的信息
    @Select("select * from carpart where carpart_name=#{carpart_name}")
    Carpart selectByName(String carpart_name);
}
